#
import numpy as np

#
# Heviside step function
#
def heaviside(t):
	return 0.5*(np.sign(t)+1.0)

def G4(t):
	return np.power(t,3)*heaviside(t)

def G4p(t):
	return 3*np.power(t,2)*heaviside(t)

def G4pp(t):
	return 6*np.power(t,1)*heaviside(t)

#
# Dirac delta function
#
def delta(t):
	return 16*(G4(t)-4*G4(t-0.25)+6*G4(t-0.5)-4*G4(t-0.75)+G4(t-1.0))

def deltap(t):
	return 16*(G4p(t)-4*G4p(t-0.25)+6*G4p(t-0.5)-4*G4p(t-0.75)+G4p(t-1.0))

def deltapp(t):
	return 16*(G4pp(t)-4*G4pp(t-0.25)+6*G4pp(t-0.5)-4*G4pp(t-0.75)+G4pp(t-1.0))

def ux(t, T, A):
	return A*delta(t/T)

def vx(t, T, A):
	return A*deltap(t/T)/T

def ax(t, T, A):
	return A*deltapp(t/T)/(T*T)

